package com.lqd.mall.system.service.impl;

import com.lqd.mall.interaction.system.SysUserEntity;
import com.lqd.mall.jpa.service.impl.BaseServiceImpl;
import com.lqd.mall.system.repository.SysUserEntityRepository;
import com.lqd.mall.system.service.ISysUserService;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.List;
import java.util.Optional;

/**
 * @author 零起点
 * @create 2022-02-10 23:17
 */
@Service
public class SysUserServiceImpl
        extends BaseServiceImpl<SysUserEntityRepository,SysUserEntity,Long>
        implements ISysUserService {

    @Resource
    SysUserEntityRepository sysUserEntityRepository;

    @Override
    public List<SysUserEntity> findSysUserEntitieList(SysUserEntity entity) {
        return sysUserEntityRepository.findByUserName(entity.getUserName());
    }

    @Override
    public SysUserEntity selectUserById(Long userId) {
        Optional<SysUserEntity> entity = sysUserEntityRepository.findById(userId);
        return entity.orElse(null);
    }


}
